<?php
// echo "注册页";
require_once './include.php';

$PG = new pgsql("gis24.jlu3s.com", "23456", "ccly", "sde", "GIScontest2024");  
$PG->connect();  
      
if(!$PG)  
{  
    $db_error = "无法连接到PostGreSQL数据库！";  
    echo $db_error;   
}  
else  
{  
    //echo "成功连接！"; 
    $query = "SELECT * FROM public.region";
    $rows = $PG->fetchAll($query); 
    //var_dump($rows[0]["prov_code"]);
    //alertMes("操作成功哦”！","");

    //if(is_null($rows)){ echo "未查到相关数据";}else{ foreach($rows as $row):echo $row['prov_name'];endforeach;}
}    

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册新账号</title>
<link type="text/css" rel="stylesheet" href="./css/mylogin.css">
<style>
    tr{
        line-height: 40px;
    }
</style>

<script language="javascript">
	function checksubmit(){
		if(document.reg.username.value==""){
			alert("用户名不能为空！");
			document.reg.username.focus();
			return false;
		}
		else if(document.reg.password.value==""){
			alert("密码不能为空！");
			document.reg.password.focus();
			return false;
		}
		else if(document.reg.password.value!=document.reg.password2.value){
			alert("两次输入的密码不一致！请检查。");
			document.reg.password.focus();
			return false;
		}
		else if(document.reg.name.value==""){
			alert("姓名不能为空！");
			document.reg.name.focus();
			return false;
		}  
		return true;  
	}
</script>

</head>
<body class="bg-img-reg">

<h2 align="center" style="font-family:'楷体';font-size:3em; " >欢迎注册长春市旅游服务及管理系统新账号</h2>

<div class="regBox">
<h3>注册新账号:</h3>
<form action="doReg.php" method="post" id="reg" name="reg" onsubmit="return checksubmit()" >
<table width="100%" border="0.1" cellpadding="0" cellspacing="0" bgcolor="#FFE7BA">	
	<tr>
		<td align="right"><span style="color:red;">*</span> 姓名：</td>
		<td><input type="text" name="name" class=" :wait;5500 :min_length;2 " /><span style="color:blue;font-size:12px;">[注意:请输入自己的真实姓名，以便更好地沟通哦]</span></td>
	</tr>	
	<tr>
		<td align="right"><span style="color:red;">*</span> 性别：</td>
		<td><div class="input_item">
    			<input type="radio"  name="gender" value="1"> 男
    			<input type="radio"  checked="checked" name="gender" value="2" > 女
			</div>
		</td>
	</tr>
    <tr>
		<td align="right">电话（手机号）：</td>
		<td><input type="text" name="phone"  id="phone" /></td>
	</tr>
    <tr>
		<td align="right">电子邮箱：</td>
		<td><input type="text" name="email"  id="email" /></td>
	</tr>
    <tr>
		<td align="right"><span style="color:red;">*</span> 家乡：</td>
		<td>
		  <select name="area_code" >
		  		<!-- 
                <option value="2200" selected="selected">吉林省</option>
				<option value="2100">辽宁省</option>
				-->
                <?php if(is_null($rows)){ echo "未查到相关数据";}else{ foreach($rows as $row): ?>
                    <option value="<?php echo $row['prov_code']; ?>" ><?php echo $row['prov_name']; ?></option>
                <?php endforeach;} ?>    
		  </select>
		</td>
	</tr>
    <tr>
		<td align="right"><span style="color:red;">*</span> 用户名：</td>
		<td><input type="text" name="username" /><span style="color:blue;font-size:12px;">[注意:不能与别人重复;注册后不能随便更改）]</span></td>
	</tr>
	<tr>
		<td align="right"><span style="color:red;">*</span>密码：</td>
		<td width="80%"><input type="password" name="password"  id="pass"/></td>
	</tr>
	<tr>
		<td align="right"><span style="color:red;">*</span>确认密码：</td>
		<td><input type="password" name="password2" id="pass2"/></td>
	</tr>
	<tr>	
	   <td colspan="2"><input type="hidden" name="power_id" value="1"></td> <!-- 隐藏值，设置值为1，表示默认用户注册为普通用户 -->
	</tr>
	<tr>	
	   <td></td>
	   <td align="left">
            <input type="submit" value="注册" style="cursor:pointer;width:100px;height:30px;"/>	       
	       &nbsp;<span style="font-size:12px;">已有账号？&nbsp;&nbsp;&nbsp;</span><a href="login.php" style="color:blue;width:90px;font-size:12px;">登录</a>
	   </td>
	</tr>	
</table>
</form>

</div>

</body>
</html>

